﻿#include "Predict.h"
#include <iostream> 
#include <opencv2/opencv.hpp> 

#include <direct.h>
#include "utils.hpp"

using namespace std; //加上这句


int main()
{ 

	

	//C++查看系统当前目录
	//char buffer[_MAX_PATH];
	//_getcwd(buffer, _MAX_PATH);

	//std::string str1 = "";
	//str1.append(buffer); 

	//std::string str2 = str1 + "model/cascade.xml";


	//strcpy_s(buffer, str1.length() + 1, str1.c_str());







	//std::cout << str2.c_str() << std::endl;
	//system("Pause");
	//return -1;

	//std:string txtUrl = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"\XXX.txt";


	
	//predict(modelImage, modelImageSize, aa);
	//predict(modelImage, modelImageSize, aa);  
	 
	char* model = new char[9]; 
	strcpy_s(model,11, "E:/face/");
	jlong handle = init(model);

	cv::Mat image = cv::imread("F:\\face\\5.jpg");
	//char* resut2 = predictMat(image, 1, handle);

	char* modelImage; //char数组
	int size = Utils::matToBytes(image,modelImage);


	//char* aa = new char[100];
	//int size = image.total() * image.elemSize();
	//size = size * sizeof(unsigned char);
	cout << size << endl;


	char* resutl = predict(handle,modelImage, size);
	


	cout << resutl << endl;
	//system("Pause");
	 
		/// C定义接口(字符串当作参数传入):
	
	//std::string str1 = "[";
	//std::string str2 = "]";
	//str1.append("sdsfasfsaff");
	//str1.append(str2); 

	//str1.erase(str1.end() - 1);
	//str1.append(str2);
	//char buf[sizeof(str1)];
	//strcpy_s(buf, sizeof(str1), str1.c_str());
	//printf("%s", buf);

	  
}
